-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/postgresql: extension based hardening relaxation #355010
Conversation
d64bb68
to
5b1bddb
Compare
FTR as elaborated in the previous PR I also think that this is the correct approach. |
5aa3d62
to
c083150
Compare
Okay, I moved a few things around and I think that should do the trick. |
433de7c
to
34b0cad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach is good!
34b0cad
to
4e31d58
Compare
4e31d58
to
3e89e09
Compare
3e89e09
to
6100305
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wolfgangwalther the current patch seems fine, the name
of a derivation doesn't fail to evaluate if meta.broken = true;
:
❯ ~/Projects/nixpkgs master → nix-instantiate -A postgresqlJitPackages.plv8.name --eval
"plv8-3.2.3"
❯ ~/Projects/nixpkgs master → nix-instantiate -A postgresqlJitPackages.plv8
[...]
error: Package ‘plv8-3.2.3’ in /home/ma27/Projects/nixpkgs/pkgs/servers/sql/postgresql/ext/plv8/default.nix:136 is marked as broken, refusing to evaluate.
[...]
@mweinelt can you rebase, please?
I don't understand what that means. I might have missed something, but I think the current approach in here, i.e. adding |
6100305
to
ecff738
Compare
@mweinelt OK rebased now to have a look. :)
To me the conversation above read like the hardening checks in the module itself were the issue, however these can be evaluated even if the extensions are marked as broken. But you're right, using plv8 in the test-case is the problem.
I'd be fine with doing the plv8 check only in the non-JIT test-cases of the An idea I just had was that we could actually build a single VM test for all extensions that require testing using the VM-test framework, but that'd obviously have the downside that Idk. personally I'd be fine with the amount of VM tests, it's not like I'd expect contributors to run all of them. |
Makes sense to me.
I thought about that as well, but as you say this won't work nicely for passthru tests.. so don't think this is that helpful overall.
I think we can reduce the number of VM tests a bit as well, by moving some of the tests into the extension's derivation as non-VM. I already did that with two of the extensions in the passthru.tests PR. There are two more that could be done like that (tsja and wal2json, IIRC). They just need a bit more fiddling with the code than I was willing to invest in that PR. |
Great. If @mweinelt is fine with that, I'd fix the PR up accordingly tomorrow. I'll split it into another VM test (and tryo to get the wal2json/tsja into non-VM-tests - unless you're motivated to invest tie into that). Won't happen immediately though. |
This is the upstream lingo, and it makes everything slightly less confusing.
ecff738
to
0b15522
Compare
By matching on the package names of the plugins passed into the package we can relax the systemd unit hardening as needed.
The plv8 plugin requires access to pkey syscalls. The execution will crash hard when it is not allowed by the syscall filter. Co-Authored-By: Jan Tojnar <[email protected]>
0b15522
to
a06618e
Compare
PostgreSQL with JIT support enabled doesn't work with plv8. Hence, we'd get an evaluation failure for each `nixosTests.postgresql.postgresql.postgresql_jit_X`. This should be restructured in the future (less VM tests for custom extensions, but a single VM test for this case to cover). For now, we should get this fix out and this is a good-enough approach.
a06618e
to
68d9643
Compare
Successfully created backport PR for |
the docs where forgotten to be updated #358159 |
So this is the initial idea I had about how to relax the hardening when certain plugins are used.
I fully expect the certain scenario to be incomplete wrt. MemoryDenyWriteExecute, if it does indeed us V8.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.